package com.app.util.file;

import java.io.File;
import java.io.FilenameFilter;

public class FilenameFilters {

	public static FilenameFilter newExtFilenameFilter(final String ext) {
		return newExtFilenameFilter(ext, false);
	}

	public static FilenameFilter newExtFilenameFilter(final String ext, final boolean ignorecase) {
		return new FilenameFilter() {
			public boolean accept(File dir, String name) {
				if (ignorecase) {
					return ext.equalsIgnoreCase(FilenameUtil.getExtension(name));
				}
				return ext.equals(FilenameUtil.getExtension(name));
			}
		};
	}

}
 